<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MiXiM: BaseConnectionManager Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">MiXiM
   &#160;<span id="projectnumber">2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('a00019.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-types">Protected Types</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="#pri-methods">Private Member Functions</a>  </div>
  <div class="headertitle">
<div class="title">BaseConnectionManager Class Reference<div class="ingroups"><a class="el" href="a00517.html">connectionManager - channel and connection related classes</a></div></div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="BaseConnectionManager" -->
<p>Module to control the channel and handle all connection related stuff.  
 <a href="a00019.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="a00245_source.html">BaseConnectionManager.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for BaseConnectionManager:</div>
<div class="dyncontent">
<div class="center"><img src="a00569.png" border="0" usemap="#BaseConnectionManager_inherit__map" alt="Inheritance graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for BaseConnectionManager:</div>
<div class="dyncontent">
<div class="center"><img src="a00570.png" border="0" usemap="#BaseConnectionManager_coll__map" alt="Collaboration graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>

<p><a href="a00571.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="nested-classes"></a>
Classes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00066.html">CoordSet</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Represents an minimalistic (hash)set of GridCoords.  <a href="a00066.html#details">More...</a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00097.html">GridCoord</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Represents a position inside a grid.  <a href="a00097.html#details">More...</a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a046d0df64848f1932ac1580be9d5306f"></a><!-- doxytag: member="BaseConnectionManager::numInitStages" ref="a046d0df64848f1932ac1580be9d5306f" args="() const " -->
virtual int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a046d0df64848f1932ac1580be9d5306f">numInitStages</a> () const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Needs two initialization stages. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0d39342f1e732ad44ef7e4e2dccac24f"></a><!-- doxytag: member="BaseConnectionManager::initialize" ref="a0d39342f1e732ad44ef7e4e2dccac24f" args="(int stage)" -->
virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a0d39342f1e732ad44ef7e4e2dccac24f">initialize</a> (int stage)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Reads init parameters and calculates a maximal interference distance. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a2ee333e0335730f5f6bd346d59a9813e">registerNic</a> (cModule *nic, <a class="el" href="a00053.html">ConnectionManagerAccess</a> *chAccess, const <a class="el" href="a00065.html">Coord</a> *nicPos)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Registers a nic to have its connections managed by <a class="el" href="a00052.html" title="BaseConnectionManager implementation which only defines a specific max interference distance...">ConnectionManager</a>.  <a href="#a2ee333e0335730f5f6bd346d59a9813e"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a3e3f6ea1da0e15af3c91493dcfdc22ba">unregisterNic</a> (cModule *nic)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Unregisters a NIC such that its connections aren't managed by the CM anymore.  <a href="#a3e3f6ea1da0e15af3c91493dcfdc22ba"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8dbfe21d2205c13ab6373245dd432353"></a><!-- doxytag: member="BaseConnectionManager::updateNicPos" ref="a8dbfe21d2205c13ab6373245dd432353" args="(NicEntry::t_nicid_cref nicID, const Coord *newPos)" -->
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a8dbfe21d2205c13ab6373245dd432353">updateNicPos</a> (NicEntry::t_nicid_cref nicID, const <a class="el" href="a00065.html">Coord</a> *newPos)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Updates the position information of a registered nic. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0d0325d9aee770539d802b878ebf32cf"></a><!-- doxytag: member="BaseConnectionManager::getGateList" ref="a0d0325d9aee770539d802b878ebf32cf" args="(NicEntry::t_nicid_cref nicID) const " -->
const <a class="el" href="a00159.html#a209882de7781ff52db0ae559c1654e08">NicEntry::GateList</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a0d0325d9aee770539d802b878ebf32cf">getGateList</a> (NicEntry::t_nicid_cref nicID) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the ingates of all nics in range. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6911cdbad686c0f471df22da1351cb69"></a><!-- doxytag: member="BaseConnectionManager::getOutGateTo" ref="a6911cdbad686c0f471df22da1351cb69" args="(const NicEntry *nic, const NicEntry *targetNic) const " -->
const cGate *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a6911cdbad686c0f471df22da1351cb69">getOutGateTo</a> (const <a class="el" href="a00159.html">NicEntry</a> *nic, const <a class="el" href="a00159.html">NicEntry</a> *targetNic) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the ingate of the with id==targetID, or 0 if not in range. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-types"></a>
Protected Types</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8438ef8cd5adf3c9f3804f088813679e"></a><!-- doxytag: member="BaseConnectionManager::NicEntries" ref="a8438ef8cd5adf3c9f3804f088813679e" args="" -->
typedef std::map<br class="typebreak"/>
&lt; <a class="el" href="a00159.html#ae9ce6e70f7231c299aac66e4cde88671">NicEntry::t_nicid</a>, <a class="el" href="a00159.html">NicEntry</a> * &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a8438ef8cd5adf3c9f3804f088813679e">NicEntries</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Type for map from nic-module id to nic-module pointer. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a07e3ba99630593a0b453056767f3c419"></a><!-- doxytag: member="BaseConnectionManager::RowVector" ref="a07e3ba99630593a0b453056767f3c419" args="" -->
typedef std::vector&lt; <a class="el" href="a00019.html#a8438ef8cd5adf3c9f3804f088813679e">NicEntries</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a07e3ba99630593a0b453056767f3c419">RowVector</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Type for 1-dimensional array of NicEntries. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a332ff3a0e07c412efaaa2332b00b1c38"></a><!-- doxytag: member="BaseConnectionManager::NicMatrix" ref="a332ff3a0e07c412efaaa2332b00b1c38" args="" -->
typedef std::vector&lt; <a class="el" href="a00019.html#a07e3ba99630593a0b453056767f3c419">RowVector</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a332ff3a0e07c412efaaa2332b00b1c38">NicMatrix</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Type for 2-dimensional array of NicEntries. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6b43342fe2608cb862e03c07cf9f799b"></a><!-- doxytag: member="BaseConnectionManager::NicCube" ref="a6b43342fe2608cb862e03c07cf9f799b" args="" -->
typedef std::vector&lt; <a class="el" href="a00019.html#a332ff3a0e07c412efaaa2332b00b1c38">NicMatrix</a> &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a6b43342fe2608cb862e03c07cf9f799b">NicCube</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Type for 3-dimensional array of NicEntries. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a00b2487d2565c70a46101964a2767643">calcInterfDist</a> ()=0</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculate interference distance.  <a href="#a00b2487d2565c70a46101964a2767643"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a385acdbacf030906826f7ee09b683a81">registerNicExt</a> (NicEntry::t_nicid_cref nicID)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Called by "registerNic()" after the nic has been unregistered. That means that the <a class="el" href="a00159.html" title="NicEntry is used by ConnectionManager to store the necessary information for each nic...">NicEntry</a> for the nic has already been disconnected and removed from nic map.  <a href="#a385acdbacf030906826f7ee09b683a81"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a01ca86d85b1ce76a5e128daeabd95cfa">unregisterNicExt</a> (NicEntry::t_nicid_cref nicID)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Called by "unregisterNic()" after the nic has been registered. That means that the <a class="el" href="a00159.html" title="NicEntry is used by ConnectionManager to store the necessary information for each nic...">NicEntry</a> for the nic has already been created and added to nics map.  <a href="#a01ca86d85b1ce76a5e128daeabd95cfa"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#af37541b95430b53676895f25131f42ff">updateConnections</a> (NicEntry::t_nicid_cref nicID, const <a class="el" href="a00065.html">Coord</a> *oldPos, const <a class="el" href="a00065.html">Coord</a> *newPos)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Updates the connections of the nic with "nicID".  <a href="#af37541b95430b53676895f25131f42ff"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a418d9fb4151ff38840838a94189ba8b6">isInRange</a> (NicEntries::mapped_type pFromNic, NicEntries::mapped_type pToNic)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Check if the two nic's are in range.  <a href="#a418d9fb4151ff38840838a94189ba8b6"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9e2d47a851899da506730fcdda24030e"></a><!-- doxytag: member="BaseConnectionManager::nics" ref="a9e2d47a851899da506730fcdda24030e" args="" -->
<a class="el" href="a00019.html#a8438ef8cd5adf3c9f3804f088813679e">NicEntries</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a9e2d47a851899da506730fcdda24030e">nics</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Map from nic-module ids to nic-module pointers. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6b75c5b6311b76e4894d669524a15043"></a><!-- doxytag: member="BaseConnectionManager::coreDebug" ref="a6b75c5b6311b76e4894d669524a15043" args="" -->
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a6b75c5b6311b76e4894d669524a15043">coreDebug</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Set debugging for the basic module. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="acdfe4a6c7e4d6cfc729219946488a1be"></a><!-- doxytag: member="BaseConnectionManager::sendDirect" ref="acdfe4a6c7e4d6cfc729219946488a1be" args="" -->
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#acdfe4a6c7e4d6cfc729219946488a1be">sendDirect</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Does the <a class="el" href="a00052.html" title="BaseConnectionManager implementation which only defines a specific max interference distance...">ConnectionManager</a> use sendDirect or not? <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab68d40f806cce405a8e97958f1245303"></a><!-- doxytag: member="BaseConnectionManager::playgroundSize" ref="ab68d40f806cce405a8e97958f1245303" args="" -->
const <a class="el" href="a00065.html">Coord</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#ab68d40f806cce405a8e97958f1245303">playgroundSize</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Stores the size of the playground. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1570049e688ff532c2454fce2ef02f3f"></a><!-- doxytag: member="BaseConnectionManager::maxInterferenceDistance" ref="a1570049e688ff532c2454fce2ef02f3f" args="" -->
double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a1570049e688ff532c2454fce2ef02f3f">maxInterferenceDistance</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">the biggest interference distance in the network. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa9b0c739744c1eafd365add0afe4a037"></a><!-- doxytag: member="BaseConnectionManager::maxDistSquared" ref="aa9b0c739744c1eafd365add0afe4a037" args="" -->
double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#aa9b0c739744c1eafd365add0afe4a037">maxDistSquared</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Square of maxInterferenceDistance cache a value that is often used. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ade8a5353ad5be39ebb3830e45ec64fbc"></a><!-- doxytag: member="BaseConnectionManager::useTorus" ref="ade8a5353ad5be39ebb3830e45ec64fbc" args="" -->
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#ade8a5353ad5be39ebb3830e45ec64fbc">useTorus</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Stores the useTorus flag of the WorldUtility. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="acc2243ef90f9857769043cd040c48705"></a><!-- doxytag: member="BaseConnectionManager::drawMIR" ref="acc2243ef90f9857769043cd040c48705" args="" -->
bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#acc2243ef90f9857769043cd040c48705">drawMIR</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Stores if maximum interference distance should be displayed in TkEnv. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00019.html#a6b43342fe2608cb862e03c07cf9f799b">NicCube</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a4d9992e134da9af1d9b90deba1d7759a">nicGrid</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Register of all nics.  <a href="#a4d9992e134da9af1d9b90deba1d7759a"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="a00065.html">Coord</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a9a4bce8e878f2d6aa18fb2606f6d8409">findDistance</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Distance that helps to find a node under a certain position.  <a href="#a9a4bce8e878f2d6aa18fb2606f6d8409"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afea80604515a28ff8a6a1d07b9b0a9d3"></a><!-- doxytag: member="BaseConnectionManager::gridDim" ref="afea80604515a28ff8a6a1d07b9b0a9d3" args="" -->
<a class="el" href="a00097.html">GridCoord</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#afea80604515a28ff8a6a1d07b9b0a9d3">gridDim</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The size of the grid. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pri-methods"></a>
Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af36a4fd1f31773f63187cc9717441a98"></a><!-- doxytag: member="BaseConnectionManager::updateNicConnections" ref="af36a4fd1f31773f63187cc9717441a98" args="(NicEntries &amp;nmap, NicEntries::mapped_type nic)" -->
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#af36a4fd1f31773f63187cc9717441a98">updateNicConnections</a> (<a class="el" href="a00019.html#a8438ef8cd5adf3c9f3804f088813679e">NicEntries</a> &amp;nmap, NicEntries::mapped_type nic)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Manages the connections of a registered nic. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a16e2ed3f54ca82817f0ee8a8522a4a86"></a><!-- doxytag: member="BaseConnectionManager::checkGrid" ref="a16e2ed3f54ca82817f0ee8a8522a4a86" args="(GridCoord &amp;oldCell, GridCoord &amp;newCell, NicEntry::t_nicid_cref id)" -->
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a16e2ed3f54ca82817f0ee8a8522a4a86">checkGrid</a> (<a class="el" href="a00097.html">GridCoord</a> &amp;oldCell, <a class="el" href="a00097.html">GridCoord</a> &amp;newCell, NicEntry::t_nicid_cref id)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Check connections of a nic in the grid. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6f22acc9201a4bcef5c738f4aec66529"></a><!-- doxytag: member="BaseConnectionManager::getCellForCoordinate" ref="a6f22acc9201a4bcef5c738f4aec66529" args="(const Coord &amp;c) const " -->
<a class="el" href="a00097.html">GridCoord</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a6f22acc9201a4bcef5c738f4aec66529">getCellForCoordinate</a> (const <a class="el" href="a00065.html">Coord</a> &amp;c) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Calculates the corresponding cell of a coordinate. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a417b0fbfe52596afd9d26a98f0cf0c32"></a><!-- doxytag: member="BaseConnectionManager::getCellEntries" ref="a417b0fbfe52596afd9d26a98f0cf0c32" args="(const GridCoord &amp;cell)" -->
<a class="el" href="a00019.html#a8438ef8cd5adf3c9f3804f088813679e">NicEntries</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a417b0fbfe52596afd9d26a98f0cf0c32">getCellEntries</a> (const <a class="el" href="a00097.html">GridCoord</a> &amp;cell)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the NicEntries of the cell with specified coordinate. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#ac460ea324e64948008f551159b58130b">wrapIfTorus</a> (int value, int max) const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4d96862ff7bb89a13dee8e643c1fa947"></a><!-- doxytag: member="BaseConnectionManager::fillUnionWithNeighbors" ref="a4d96862ff7bb89a13dee8e643c1fa947" args="(CoordSet &amp;gridUnion, const GridCoord &amp;cell) const " -->
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a4d96862ff7bb89a13dee8e643c1fa947">fillUnionWithNeighbors</a> (<a class="el" href="a00066.html">CoordSet</a> &amp;gridUnion, const <a class="el" href="a00097.html">GridCoord</a> &amp;cell) const </td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Adds every direct Neighbor of a <a class="el" href="a00097.html" title="Represents a position inside a grid.">GridCoord</a> to a union of coords. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7377116ab228d89a70dcfcc8091b5bfc"></a><!-- doxytag: member="BaseConnectionManager::BaseConnectionManager" ref="a7377116ab228d89a70dcfcc8091b5bfc" args="(const BaseConnectionManager &amp;)" -->
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a7377116ab228d89a70dcfcc8091b5bfc">BaseConnectionManager</a> (const <a class="el" href="a00019.html">BaseConnectionManager</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy constructor is not allowed. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2748ca6453fa93fd6028986bbeb875dc"></a><!-- doxytag: member="BaseConnectionManager::operator=" ref="a2748ca6453fa93fd6028986bbeb875dc" args="(const BaseConnectionManager &amp;)" -->
<a class="el" href="a00019.html">BaseConnectionManager</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00019.html#a2748ca6453fa93fd6028986bbeb875dc">operator=</a> (const <a class="el" href="a00019.html">BaseConnectionManager</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Assignment operator is not allowed. <br/></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Module to control the channel and handle all connection related stuff. </p>
<p>The central module that coordinates the connections between all nodes, and handles dynamic gate creation. <a class="el" href="a00019.html" title="Module to control the channel and handle all connection related stuff.">BaseConnectionManager</a> therefore periodically communicates with the <a class="el" href="a00053.html" title="Basic class for all physical layers, please don&#39;t touch!!">ConnectionManagerAccess</a> modules</p>
<p>You may not instantiate BaseConnectionManager! Use <a class="el" href="a00052.html" title="BaseConnectionManager implementation which only defines a specific max interference distance...">ConnectionManager</a> instead.</p>
<dl class="author"><dt><b>Author:</b></dt><dd>Steffen Sroka, Daniel Willkomm, Karl Wessel </dd>
<dd>
Christoph Sommer ("unregisterNic()"-method) </dd></dl>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="a00053.html" title="Basic class for all physical layers, please don&#39;t touch!!">ConnectionManagerAccess</a> </dd></dl>
</div><hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a00b2487d2565c70a46101964a2767643"></a><!-- doxytag: member="BaseConnectionManager::calcInterfDist" ref="a00b2487d2565c70a46101964a2767643" args="()=0" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">virtual double BaseConnectionManager::calcInterfDist </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td><code> [protected, pure virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Calculate interference distance. </p>
<p>Called by <a class="el" href="a00019.html" title="Module to control the channel and handle all connection related stuff.">BaseConnectionManager</a> already during initialization stage 0. Implementations therefore have to make sure that everything necessary for calculation is either already initialized or has to be initialized in this method!</p>
<p>This method has to be overridden by any derived class. </p>

<p>Implemented in <a class="el" href="a00221.html#ae83d638608dcf8d6267f3673792b914c">UnitDisk</a>, and <a class="el" href="a00052.html#abeb688210449aa6a62cb9cd76e5cfeaa">ConnectionManager</a>.</p>

<p>Referenced by <a class="el" href="a00019.html#a0d39342f1e732ad44ef7e4e2dccac24f">initialize()</a>.</p>

</div>
</div>
<a class="anchor" id="a418d9fb4151ff38840838a94189ba8b6"></a><!-- doxytag: member="BaseConnectionManager::isInRange" ref="a418d9fb4151ff38840838a94189ba8b6" args="(NicEntries::mapped_type pFromNic, NicEntries::mapped_type pToNic)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool BaseConnectionManager::isInRange </td>
          <td>(</td>
          <td class="paramtype">NicEntries::mapped_type&#160;</td>
          <td class="paramname"><em>pFromNic</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">NicEntries::mapped_type&#160;</td>
          <td class="paramname"><em>pToNic</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Check if the two nic's are in range. </p>
<p>This function will be used to decide if two nic's shall be connected or not. It is simple to overload this function to enhance the decision for connection or not.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">pFromNic</td><td>Nic source point which should be checked. </td></tr>
    <tr><td class="paramname">pToNic</td><td>Nic target point which should be checked. </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>true if the nic's are in range and can be connected, false if not. </dd></dl>

<p>References <a class="el" href="a00019.html#aa9b0c739744c1eafd365add0afe4a037">maxDistSquared</a>, <a class="el" href="a00019.html#ab68d40f806cce405a8e97958f1245303">playgroundSize</a>, and <a class="el" href="a00019.html#ade8a5353ad5be39ebb3830e45ec64fbc">useTorus</a>.</p>

<p>Referenced by <a class="el" href="a00019.html#af36a4fd1f31773f63187cc9717441a98">updateNicConnections()</a>.</p>
<div class="fragment"><pre class="fragment">{
  <span class="keywordtype">double</span> dDistance = 0.0;

    <span class="keywordflow">if</span>(<a class="code" href="a00019.html#ade8a5353ad5be39ebb3830e45ec64fbc" title="Stores the useTorus flag of the WorldUtility.">useTorus</a>) {
      dDistance = pFromNic-&gt;pos.sqrTorusDist(pToNic-&gt;pos, *<a class="code" href="a00019.html#ab68d40f806cce405a8e97958f1245303" title="Stores the size of the playground.">playgroundSize</a>);
    } <span class="keywordflow">else</span> {
      dDistance = pFromNic-&gt;pos.sqrdist(pToNic-&gt;pos);
    }
    <span class="keywordflow">return</span> (dDistance &lt;= <a class="code" href="a00019.html#aa9b0c739744c1eafd365add0afe4a037" title="Square of maxInterferenceDistance cache a value that is often used.">maxDistSquared</a>);
}
</pre></div>
</div>
</div>
<a class="anchor" id="a2ee333e0335730f5f6bd346d59a9813e"></a><!-- doxytag: member="BaseConnectionManager::registerNic" ref="a2ee333e0335730f5f6bd346d59a9813e" args="(cModule *nic, ConnectionManagerAccess *chAccess, const Coord *nicPos)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool BaseConnectionManager::registerNic </td>
          <td>(</td>
          <td class="paramtype">cModule *&#160;</td>
          <td class="paramname"><em>nic</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="a00053.html">ConnectionManagerAccess</a> *&#160;</td>
          <td class="paramname"><em>chAccess</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="a00065.html">Coord</a> *&#160;</td>
          <td class="paramname"><em>nicPos</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Registers a nic to have its connections managed by <a class="el" href="a00052.html" title="BaseConnectionManager implementation which only defines a specific max interference distance...">ConnectionManager</a>. </p>
<p>If you want to do your own stuff at the registration of a nic see "registerNicExt()". </p>

<p>References <a class="el" href="a00019.html#a6b75c5b6311b76e4894d669524a15043">coreDebug</a>, <a class="el" href="a00019.html#acc2243ef90f9857769043cd040c48705">drawMIR</a>, <a class="el" href="a00019.html#a1570049e688ff532c2454fce2ef02f3f">maxInterferenceDistance</a>, <a class="el" href="a00019.html#a9e2d47a851899da506730fcdda24030e">nics</a>, <a class="el" href="a00019.html#a385acdbacf030906826f7ee09b683a81">registerNicExt()</a>, <a class="el" href="a00019.html#acdfe4a6c7e4d6cfc729219946488a1be">sendDirect</a>, and <a class="el" href="a00019.html#af37541b95430b53676895f25131f42ff">updateConnections()</a>.</p>

<p>Referenced by <a class="el" href="a00053.html#a941b21fa937363875b42c0c930aaa58b">ConnectionManagerAccess::receiveSignal()</a>.</p>
<div class="fragment"><pre class="fragment">{
  assert(nic != NULL);

  <span class="keyword">const</span> <a class="code" href="a00159.html#ae9ce6e70f7231c299aac66e4cde88671" title="Type for NIC identifier.">NicEntry::t_nicid</a> nicID = nic-&gt;getId();
  ccEV &lt;&lt; <span class="stringliteral">&quot; registering nic #&quot;</span> &lt;&lt; nicID &lt;&lt; endl;

  <span class="comment">// create new NicEntry</span>
  NicEntries::mapped_type nicEntry;
  cModule *<span class="keyword">const</span>          pHostModule = <a class="code" href="a00093.html" title="Provides method templates to find omnet modules.">FindModule&lt;&gt;::findHost</a>(nic);

  <span class="keywordflow">if</span>(<a class="code" href="a00019.html#acdfe4a6c7e4d6cfc729219946488a1be" title="Does the ConnectionManager use sendDirect or not?">sendDirect</a>)
    nicEntry = <span class="keyword">new</span> <a class="code" href="a00162.html" title="NicEntry is used by ConnectionManager to store the necessary information for each nic...">NicEntryDirect</a>(<a class="code" href="a00019.html#a6b75c5b6311b76e4894d669524a15043" title="Set debugging for the basic module.">coreDebug</a>);
  <span class="keywordflow">else</span>
    nicEntry = <span class="keyword">new</span> <a class="code" href="a00161.html" title="NicEntry is used by ConnectionManager to store the necessary information for each nic...">NicEntryDebug</a>(<a class="code" href="a00019.html#a6b75c5b6311b76e4894d669524a15043" title="Set debugging for the basic module.">coreDebug</a>);

  <span class="comment">// fill nicEntry</span>
  nicEntry-&gt;nicPtr = nic;
  nicEntry-&gt;nicId = nicID;
  nicEntry-&gt;hostId   = pHostModule ? pHostModule-&gt;getId() : 0;
  nicEntry-&gt;pos      = *nicPos;
  nicEntry-&gt;chAccess = chAccess;

  <span class="comment">// add to map</span>
  <a class="code" href="a00019.html#a9e2d47a851899da506730fcdda24030e" title="Map from nic-module ids to nic-module pointers.">nics</a>[nicID] = nicEntry;

  <a class="code" href="a00019.html#a385acdbacf030906826f7ee09b683a81" title="Called by &quot;registerNic()&quot; after the nic has been unregistered. That means that the NicEntry for the n...">registerNicExt</a>(nicID);

  <a class="code" href="a00019.html#af37541b95430b53676895f25131f42ff" title="Updates the connections of the nic with &quot;nicID&quot;.">updateConnections</a>(nicID, nicPos, nicPos);

  <span class="keywordflow">if</span>(<a class="code" href="a00019.html#acc2243ef90f9857769043cd040c48705" title="Stores if maximum interference distance should be displayed in TkEnv.">drawMIR</a> &amp;&amp; pHostModule) {
    cDisplayString&amp; Displ = pHostModule-&gt;getDisplayString();
    <span class="keywordflow">if</span> (!Displ.containsTag(<span class="stringliteral">&quot;r&quot;</span>))
      Displ.setTagArg(<span class="stringliteral">&quot;r&quot;</span>, 0, <a class="code" href="a00019.html#a1570049e688ff532c2454fce2ef02f3f" title="the biggest interference distance in the network.">maxInterferenceDistance</a>);
  }

  <span class="keywordflow">return</span> <a class="code" href="a00019.html#acdfe4a6c7e4d6cfc729219946488a1be" title="Does the ConnectionManager use sendDirect or not?">sendDirect</a>;
}
</pre></div>
</div>
</div>
<a class="anchor" id="a385acdbacf030906826f7ee09b683a81"></a><!-- doxytag: member="BaseConnectionManager::registerNicExt" ref="a385acdbacf030906826f7ee09b683a81" args="(NicEntry::t_nicid_cref nicID)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void BaseConnectionManager::registerNicExt </td>
          <td>(</td>
          <td class="paramtype">NicEntry::t_nicid_cref&#160;</td>
          <td class="paramname"><em>nicID</em></td><td>)</td>
          <td><code> [protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Called by "registerNic()" after the nic has been unregistered. That means that the <a class="el" href="a00159.html" title="NicEntry is used by ConnectionManager to store the necessary information for each nic...">NicEntry</a> for the nic has already been disconnected and removed from nic map. </p>
<p>You better know what you are doing if you want to override this method. Most time you won't need to.</p>
<p>See <a class="el" href="a00019.html#a385acdbacf030906826f7ee09b683a81" title="Called by &quot;registerNic()&quot; after the nic has been unregistered. That means that the NicEntry for the n...">BaseConnectionManager::registerNicExt()</a> for an example.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">nicID</td><td>- the id of the <a class="el" href="a00159.html" title="NicEntry is used by ConnectionManager to store the necessary information for each nic...">NicEntry</a> </td></tr>
  </table>
  </dd>
</dl>

<p>References <a class="el" href="a00019.html#a417b0fbfe52596afd9d26a98f0cf0c32">getCellEntries()</a>, <a class="el" href="a00019.html#a6f22acc9201a4bcef5c738f4aec66529">getCellForCoordinate()</a>, <a class="el" href="a00097.html#a91ebc91e4af84ce4cf11d177d8ed7813">BaseConnectionManager::GridCoord::info()</a>, and <a class="el" href="a00019.html#a9e2d47a851899da506730fcdda24030e">nics</a>.</p>

<p>Referenced by <a class="el" href="a00019.html#a2ee333e0335730f5f6bd346d59a9813e">registerNic()</a>.</p>
<div class="fragment"><pre class="fragment">{
  NicEntries::mapped_type nicEntry = <a class="code" href="a00019.html#a9e2d47a851899da506730fcdda24030e" title="Map from nic-module ids to nic-module pointers.">nics</a>[nicID];

  GridCoord cell = <a class="code" href="a00019.html#a6f22acc9201a4bcef5c738f4aec66529" title="Calculates the corresponding cell of a coordinate.">getCellForCoordinate</a>(nicEntry-&gt;pos);

  ccEV &lt;&lt;<span class="stringliteral">&quot; registering (ext) nic at loc &quot;</span> &lt;&lt; cell.info() &lt;&lt; std::endl;

  <span class="comment">// add to matrix</span>
  <a class="code" href="a00019.html#a8438ef8cd5adf3c9f3804f088813679e" title="Type for map from nic-module id to nic-module pointer.">NicEntries</a>&amp; cellEntries = <a class="code" href="a00019.html#a417b0fbfe52596afd9d26a98f0cf0c32" title="Returns the NicEntries of the cell with specified coordinate.">getCellEntries</a>(cell);
    cellEntries[nicID] = nicEntry;
}
</pre></div>
</div>
</div>
<a class="anchor" id="a3e3f6ea1da0e15af3c91493dcfdc22ba"></a><!-- doxytag: member="BaseConnectionManager::unregisterNic" ref="a3e3f6ea1da0e15af3c91493dcfdc22ba" args="(cModule *nic)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool BaseConnectionManager::unregisterNic </td>
          <td>(</td>
          <td class="paramtype">cModule *&#160;</td>
          <td class="paramname"><em>nic</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Unregisters a NIC such that its connections aren't managed by the CM anymore. </p>
<p>NOTE: This method asserts that the passed NIC module was previously registered with this ConnectionManager!</p>
<p>This method should be used for dynamic networks were hosts can actually disappear.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">nic</td><td>the NIC module to be unregistered </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>returns true if the NIC was unregistered successfully </dd></dl>

<p>References <a class="el" href="a00066.html#aaa3c6a4f31789b4644a5bb7aaf414206">BaseConnectionManager::CoordSet::add()</a>, <a class="el" href="a00019.html#a4d96862ff7bb89a13dee8e643c1fa947">fillUnionWithNeighbors()</a>, <a class="el" href="a00019.html#a417b0fbfe52596afd9d26a98f0cf0c32">getCellEntries()</a>, <a class="el" href="a00019.html#a6f22acc9201a4bcef5c738f4aec66529">getCellForCoordinate()</a>, <a class="el" href="a00019.html#afea80604515a28ff8a6a1d07b9b0a9d3">gridDim</a>, <a class="el" href="a00097.html#a91ebc91e4af84ce4cf11d177d8ed7813">BaseConnectionManager::GridCoord::info()</a>, <a class="el" href="a00066.html#a02d6a8788ed22b635e7d8edbcb576d9d">BaseConnectionManager::CoordSet::next()</a>, <a class="el" href="a00019.html#a9e2d47a851899da506730fcdda24030e">nics</a>, and <a class="el" href="a00019.html#a01ca86d85b1ce76a5e128daeabd95cfa">unregisterNicExt()</a>.</p>
<div class="fragment"><pre class="fragment">{
  assert(nicModule != 0);

  <span class="comment">// find nicEntry</span>
  <span class="keyword">const</span> <a class="code" href="a00159.html#ae9ce6e70f7231c299aac66e4cde88671" title="Type for NIC identifier.">NicEntry::t_nicid</a> nicID      = nicModule-&gt;getId();
  NicEntries::iterator    nicEntryIt = <a class="code" href="a00019.html#a9e2d47a851899da506730fcdda24030e" title="Map from nic-module ids to nic-module pointers.">nics</a>.find(nicID);
  ccEV &lt;&lt; <span class="stringliteral">&quot; unregistering nic #&quot;</span> &lt;&lt; nicID &lt;&lt; endl;

  <span class="keywordflow">if</span> (nicEntryIt == <a class="code" href="a00019.html#a9e2d47a851899da506730fcdda24030e" title="Map from nic-module ids to nic-module pointers.">nics</a>.end()) {
    assert(<span class="keyword">false</span>);
    <span class="keywordflow">return</span> <span class="keyword">false</span>;
  }

  NicEntries::mapped_type nicEntry = nicEntryIt-&gt;second;

  <span class="comment">// get all affected grid squares</span>
  CoordSet gridUnion(74);
  GridCoord cell = <a class="code" href="a00019.html#a6f22acc9201a4bcef5c738f4aec66529" title="Calculates the corresponding cell of a coordinate.">getCellForCoordinate</a>(nicEntry-&gt;pos);
  <span class="keywordflow">if</span>((<a class="code" href="a00019.html#afea80604515a28ff8a6a1d07b9b0a9d3" title="The size of the grid.">gridDim</a>.x == 1) &amp;&amp; (<a class="code" href="a00019.html#afea80604515a28ff8a6a1d07b9b0a9d3" title="The size of the grid.">gridDim</a>.y == 1) &amp;&amp; (<a class="code" href="a00019.html#afea80604515a28ff8a6a1d07b9b0a9d3" title="The size of the grid.">gridDim</a>.z == 1)) {
    gridUnion.add(cell);
  } <span class="keywordflow">else</span> {
    <a class="code" href="a00019.html#a4d96862ff7bb89a13dee8e643c1fa947" title="Adds every direct Neighbor of a GridCoord to a union of coords.">fillUnionWithNeighbors</a>(gridUnion, cell);
  }

  <span class="comment">// disconnect from all NICs in these grid squares</span>
  GridCoord* c = gridUnion.next();
  <span class="keywordflow">while</span>(c != 0) {
    ccEV &lt;&lt; <span class="stringliteral">&quot;Update cons in [&quot;</span> &lt;&lt; c-&gt;info() &lt;&lt; <span class="stringliteral">&quot;]&quot;</span> &lt;&lt; endl;
    <a class="code" href="a00019.html#a8438ef8cd5adf3c9f3804f088813679e" title="Type for map from nic-module id to nic-module pointer.">NicEntries</a>&amp; nmap = <a class="code" href="a00019.html#a417b0fbfe52596afd9d26a98f0cf0c32" title="Returns the NicEntries of the cell with specified coordinate.">getCellEntries</a>(*c);
    <span class="keywordflow">for</span>(NicEntries::iterator i = nmap.begin(); i != nmap.end(); ++i) {
      NicEntries::mapped_type other = i-&gt;second;
      <span class="keywordflow">if</span> (other == nicEntry)
        <span class="keywordflow">continue</span>;
      <span class="keywordflow">if</span> (other-&gt;isConnected(nicEntry)) {
        other-&gt;disconnectFrom(nicEntry);
      }
      <span class="keywordflow">if</span> (nicEntry-&gt;isConnected(other)) {
        nicEntry-&gt;disconnectFrom(other);
      }
    }
    c = gridUnion.next();
  }

  <span class="comment">// erase from grid</span>
  <a class="code" href="a00019.html#a8438ef8cd5adf3c9f3804f088813679e" title="Type for map from nic-module id to nic-module pointer.">NicEntries</a>&amp; cellEntries = <a class="code" href="a00019.html#a417b0fbfe52596afd9d26a98f0cf0c32" title="Returns the NicEntries of the cell with specified coordinate.">getCellEntries</a>(cell);
  cellEntries.erase(nicID);

  <a class="code" href="a00019.html#a01ca86d85b1ce76a5e128daeabd95cfa" title="Called by &quot;unregisterNic()&quot; after the nic has been registered. That means that the NicEntry for the n...">unregisterNicExt</a>(nicID);

  <span class="comment">// erase from list of known nics</span>
  <a class="code" href="a00019.html#a9e2d47a851899da506730fcdda24030e" title="Map from nic-module ids to nic-module pointers.">nics</a>.erase(nicEntryIt);
  <span class="keyword">delete</span> nicEntry;

  <span class="keywordflow">return</span> <span class="keyword">true</span>;
}
</pre></div>
</div>
</div>
<a class="anchor" id="a01ca86d85b1ce76a5e128daeabd95cfa"></a><!-- doxytag: member="BaseConnectionManager::unregisterNicExt" ref="a01ca86d85b1ce76a5e128daeabd95cfa" args="(NicEntry::t_nicid_cref nicID)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void BaseConnectionManager::unregisterNicExt </td>
          <td>(</td>
          <td class="paramtype">NicEntry::t_nicid_cref&#160;</td>
          <td class="paramname"><em>nicID</em></td><td>)</td>
          <td><code> [protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Called by "unregisterNic()" after the nic has been registered. That means that the <a class="el" href="a00159.html" title="NicEntry is used by ConnectionManager to store the necessary information for each nic...">NicEntry</a> for the nic has already been created and added to nics map. </p>
<p>You better know what you are doing if you want to override this method. Most time you won't need to.</p>
<p>See <a class="el" href="a00019.html#a01ca86d85b1ce76a5e128daeabd95cfa" title="Called by &quot;unregisterNic()&quot; after the nic has been registered. That means that the NicEntry for the n...">BaseConnectionManager::unregisterNicExt()</a> for an example.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">nicID</td><td>- the id of the <a class="el" href="a00159.html" title="NicEntry is used by ConnectionManager to store the necessary information for each nic...">NicEntry</a> </td></tr>
  </table>
  </dd>
</dl>

<p>Referenced by <a class="el" href="a00019.html#a3e3f6ea1da0e15af3c91493dcfdc22ba">unregisterNic()</a>.</p>
<div class="fragment"><pre class="fragment">{
  (void)nicID;
}
</pre></div>
</div>
</div>
<a class="anchor" id="af37541b95430b53676895f25131f42ff"></a><!-- doxytag: member="BaseConnectionManager::updateConnections" ref="af37541b95430b53676895f25131f42ff" args="(NicEntry::t_nicid_cref nicID, const Coord *oldPos, const Coord *newPos)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void BaseConnectionManager::updateConnections </td>
          <td>(</td>
          <td class="paramtype">NicEntry::t_nicid_cref&#160;</td>
          <td class="paramname"><em>nicID</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="a00065.html">Coord</a> *&#160;</td>
          <td class="paramname"><em>oldPos</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="a00065.html">Coord</a> *&#160;</td>
          <td class="paramname"><em>newPos</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [protected, virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Updates the connections of the nic with "nicID". </p>
<p>This method is called by "updateNicPos()" after the new Position is stored in the corresponding nic.</p>
<p>Most time you won't need to override this method.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">nicID</td><td>the id of the <a class="el" href="a00159.html" title="NicEntry is used by ConnectionManager to store the necessary information for each nic...">NicEntry</a> </td></tr>
    <tr><td class="paramname">oldPos</td><td>the old position of the nic </td></tr>
    <tr><td class="paramname">newPos</td><td>the new position of the nic </td></tr>
  </table>
  </dd>
</dl>

<p>References <a class="el" href="a00019.html#a16e2ed3f54ca82817f0ee8a8522a4a86">checkGrid()</a>, and <a class="el" href="a00019.html#a6f22acc9201a4bcef5c738f4aec66529">getCellForCoordinate()</a>.</p>

<p>Referenced by <a class="el" href="a00019.html#a2ee333e0335730f5f6bd346d59a9813e">registerNic()</a>, and <a class="el" href="a00019.html#a8dbfe21d2205c13ab6373245dd432353">updateNicPos()</a>.</p>
<div class="fragment"><pre class="fragment">{
  GridCoord oldCell = <a class="code" href="a00019.html#a6f22acc9201a4bcef5c738f4aec66529" title="Calculates the corresponding cell of a coordinate.">getCellForCoordinate</a>(*oldPos);
    GridCoord newCell = <a class="code" href="a00019.html#a6f22acc9201a4bcef5c738f4aec66529" title="Calculates the corresponding cell of a coordinate.">getCellForCoordinate</a>(*newPos);

  <a class="code" href="a00019.html#a16e2ed3f54ca82817f0ee8a8522a4a86" title="Check connections of a nic in the grid.">checkGrid</a>(oldCell, newCell, nicID );
}
</pre></div>
</div>
</div>
<a class="anchor" id="ac460ea324e64948008f551159b58130b"></a><!-- doxytag: member="BaseConnectionManager::wrapIfTorus" ref="ac460ea324e64948008f551159b58130b" args="(int value, int max) const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int BaseConnectionManager::wrapIfTorus </td>
          <td>(</td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>value</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>max</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td> const<code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">
<p>If the value is outside of its bounds (zero and max) this function returns -1 if useTorus is false and the wrapped value if useTorus is true. Otherwise its just returns the value unchanged. </p>

<p>References <a class="el" href="a00019.html#ade8a5353ad5be39ebb3830e45ec64fbc">useTorus</a>.</p>

<p>Referenced by <a class="el" href="a00019.html#a4d96862ff7bb89a13dee8e643c1fa947">fillUnionWithNeighbors()</a>.</p>
<div class="fragment"><pre class="fragment">                                                               {
  <span class="keywordflow">if</span>(value &lt; 0) {
    <span class="keywordflow">if</span>(<a class="code" href="a00019.html#ade8a5353ad5be39ebb3830e45ec64fbc" title="Stores the useTorus flag of the WorldUtility.">useTorus</a>) {
      <span class="keywordflow">return</span> max + value;
    } <span class="keywordflow">else</span> {
      <span class="keywordflow">return</span> -1;
    }
  } <span class="keywordflow">else</span> <span class="keywordflow">if</span>(value &gt;= max) {
    <span class="keywordflow">if</span>(<a class="code" href="a00019.html#ade8a5353ad5be39ebb3830e45ec64fbc" title="Stores the useTorus flag of the WorldUtility.">useTorus</a>) {
      <span class="keywordflow">return</span> value - max;
    } <span class="keywordflow">else</span> {
      <span class="keywordflow">return</span> -1;
    }
  } <span class="keywordflow">else</span> {
    <span class="keywordflow">return</span> value;
  }
}
</pre></div>
</div>
</div>
<hr/><h2>Member Data Documentation</h2>
<a class="anchor" id="a9a4bce8e878f2d6aa18fb2606f6d8409"></a><!-- doxytag: member="BaseConnectionManager::findDistance" ref="a9a4bce8e878f2d6aa18fb2606f6d8409" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="a00065.html">Coord</a> <a class="el" href="a00019.html#a9a4bce8e878f2d6aa18fb2606f6d8409">BaseConnectionManager::findDistance</a><code> [protected]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Distance that helps to find a node under a certain position. </p>
<p>Can be larger then </p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="a00019.html#a1570049e688ff532c2454fce2ef02f3f" title="the biggest interference distance in the network.">maxInterferenceDistance</a> to allow nodes to be placed into the same square if the playground is too small for the grid speedup to work. </dd></dl>

<p>Referenced by <a class="el" href="a00019.html#a0d39342f1e732ad44ef7e4e2dccac24f">initialize()</a>.</p>

</div>
</div>
<a class="anchor" id="a4d9992e134da9af1d9b90deba1d7759a"></a><!-- doxytag: member="BaseConnectionManager::nicGrid" ref="a4d9992e134da9af1d9b90deba1d7759a" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="a00019.html#a6b43342fe2608cb862e03c07cf9f799b">NicCube</a> <a class="el" href="a00019.html#a4d9992e134da9af1d9b90deba1d7759a">BaseConnectionManager::nicGrid</a><code> [protected]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Register of all nics. </p>
<p>This matrix keeps all nics according to their position. It allows to restrict the position update to a subset of all nics. </p>

<p>Referenced by <a class="el" href="a00019.html#a0d39342f1e732ad44ef7e4e2dccac24f">initialize()</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>D:/Projects/MiXiM/extsrc/mixim/src/base/connectionManager/<a class="el" href="a00245_source.html">BaseConnectionManager.h</a></li>
<li>D:/Projects/MiXiM/extsrc/mixim/src/base/connectionManager/BaseConnectionManager.cc</li>
</ul>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="a00019.html">BaseConnectionManager</a>      </li>

    <li class="footer">Generated on Tue Mar 5 2013 21:26:31 for MiXiM by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
